Skip to content

init: exit clock_worker child process on failure#581

Merged
jakecorrenti merged 1 commit intocontainers:mainfrom
jhrozek:exit_after_failed_fork
Mar 11, 2026
Merged

init: exit clock_worker child process on failure#581
jakecorrenti merged 1 commit intocontainers:mainfrom
jhrozek:exit_after_failed_fork

Conversation

@jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Mar 11, 2026

If clock_worker() returns due to an error (socket creation, bind, or recv failure), the child process falls through into the rest of main(), forking again and duplicating the workload execution.

Add _exit(1) after clock_worker() to prevent the child from continuing.

Fixes: #580

If clock_worker() returns due to an error (socket creation, bind, or
recv failure), the child process falls through into the rest of main(),
forking again and duplicating the workload execution.

Add _exit(1) after clock_worker() to prevent the child from continuing.

Fixes: containers#580

Signed-off-by: Jakub Hrozek <jakub@stacklok.com>
@jhrozek jhrozek force-pushed the exit_after_failed_fork branch from a2b8952 to f58dbc6 Compare March 11, 2026 13:10
@slp
Copy link
Collaborator

slp commented Mar 11, 2026

I've noticed this one myself when I enabled TIMESYNC in the homebrew builds and forgot to fix it 😅

Thanks for fixing it here.

@jakecorrenti jakecorrenti merged commit a584f28 into containers:main Mar 11, 2026
12 of 13 checks passed
@jhrozek
Copy link
Contributor Author

jhrozek commented Mar 12, 2026

I've noticed this one myself when I enabled TIMESYNC in the homebrew builds and forgot to fix it 😅

Thanks for fixing it here.

thanks for libkrun :-)

since you mentioned yourself hitting the issue, do you know what could be the root cause behind not being able to bind? Not asking you to do more work of course, just wondering if there's something I'm missing.

@slp
Copy link
Collaborator

slp commented Mar 12, 2026

since you mentioned yourself hitting the issue, do you know what could be the root cause behind not being able to bind? Not asking you to do more work of course, just wondering if there's something I'm missing.

You probably have configured a network interface, which automatically disables the implicit vsock device. You just need to add a vsock device explicitly: krun_add_vsock(ctx, 0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init: clock_worker child process falls through into main() on failure

4 participants